//
//  HotZiXunViewController.m
//  CarWorld
//
//  Created by yuyu on 15/3/31.
//  Copyright (c) 2015年 CarWorldTeam. All rights reserved.
//

#import "HotZiXunViewController.h"
#import "HotSectionView.h"
#import "HotZiXunRootView.h"
@interface HotZiXunViewController ()
@property(nonatomic,retain)HotSectionView *hotZiXunSectionView;
@property(nonatomic,retain)UIView *rootView;
@property(nonatomic,retain)UIView *tempView;
@end

@implementation HotZiXunViewController

- (void)dealloc
{
    [_hotZiXunSectionView release];
    [_rootView release];
    [_tempView release];
    [super dealloc];
}

- (void)loadView
{
    HotZiXunRootView *rootView = [[HotZiXunRootView alloc] init];
    self.view = rootView;
    self.hotZiXunSectionView = rootView.hotSectionView;
    self.hotZiXunSectionView.backgroundColor = [UIColor redColor];
    self.rootView = rootView.rootView;
    [rootView release];
}

- (void)changeView:(UIViewController *)VC
{
    CGRect rect = self.rootView.frame;
    rect.origin.x=rect.origin.y=0;
    VC.view.frame = rect;
    [self.tempView removeFromSuperview];
    [self.rootView addSubview:VC.view];
    self.tempView = VC.view;
    [self addChildViewController:VC];
}

- (void)clickedSectionView:(HotSectionView *)hotSectionView
{
    NSInteger index = hotSectionView.keyButton.tag;
    switch (index) {
        case 0://综述
        {
            
        }
            break;
        case 1://图片
        {
            
        }
            break;
                default:
            break;
    }
}




- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"车型详情";
    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(NSIntegerMin, NSIntegerMin) forBarMetrics:UIBarMetricsDefault];
    self.tempView = nil;
    
    NSArray *titles = [NSArray arrayWithObjects:@"评测",@"行情",@"导购", nil];
    NSMutableArray *arr = [NSMutableArray arrayWithCapacity:3];
    for (int i=0; i<titles.count; i++) {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
        [btn setTitle:titles[i] forState:UIControlStateNormal];
        [arr addObject:btn];
    }
    self.hotZiXunSectionView.buttons = arr;
    self.hotZiXunSectionView.delegate = self;
    self.view.backgroundColor = [UIColor whiteColor];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
